<div class="border">
  <div class="header">
    <span>平台信息</span>
  </div>
  <div class="content">
      <section class="example-section">
        <label class="example-margin">id :</label>
        <span>{{platformInfo.EBDID}}</span>
        <!-- <span *ngIf="ifEdit"><input type="text"[(ngModel)]="platformInfo.EBDID"></span> -->
      </section>
      <section class="example-section">
        <label class="example-margin">名称 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.EBRName}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.EBRName">
        </span>
      </section>
      <section class="example-section">
        <label class="example-margin">地址 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.Address}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.Address">
        </span>
      </section>
      <section class="example-section">
        <label class="example-margin">联系人 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.Contact}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.Contact">
        </span>
      </section>
      <section class="example-section">
        <label class="example-margin">电话 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.PhoneNumber}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.PhoneNumber">
        </span>
      </section>


      <section class="example-section">
        <label class="example-margin">经度 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.Longitube}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.Longitube">
        </span>
      </section>
      <section class="example-section">
        <label class="example-margin">纬度 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.Latitude}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.Latitude">
        </span>
      </section>
      <section class="example-section">
        <label class="example-margin">网络地址 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.URL}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.URL">
        </span>
      </section>

      <!-- <section class="example-section">
        <label class="example-margin">心跳间隔 :</label>
        <span *ngIf="!ifEdit">{{platformInfo.heartInterval}}</span>
        <span *ngIf="ifEdit">
          <input type="text" [(ngModel)]="platformInfo.heartInterval">
        </span>
      </section> -->

      <section class="example-section">
        <label class="example-margin">平台状态 :</label>
        <span>{{statusArray[platformInfo.stateCode-1]}}</span>
        <button md-button *ngIf="platformInfo.stateCode !== 3" class = 'error' (click) = "changeState(3)">发生故障</button>
        <button md-button *ngIf="platformInfo.stateCode == 3" class = 'green' (click) = "changeState(1)">解除故障</button>
      </section>
      <section class="">
        <label class="example-margin">接入节点 :</label>
        <div *ngFor="let item of platformInfo.accessNodes, let i = index" class='access_item'>
          <span style="width: 150px; display:inline-block" *ngIf="!item.edit">{{item.ip}}</span>
          <input type="text" [(ngModel)] = 'item.ip' *ngIf="item.edit">
          <i class="iconfont icon-bianji" mdTooltip='编辑' *ngIf="!item.edit" (click) = 'item.edit = true'></i>
          <i class="iconfont icon-baocun" mdTooltip='保存' *ngIf="item.edit" (click) = 'saveNode(item)'></i>
          <i class="iconfont icon-shanchu" mdTooltip='删除' *ngIf="!item.edit" (click) = 'deleteNode(item)'></i>
          <md-slide-toggle class="example-margin" [color]="primary" [(ngModel)]="item.enabel" [mdTooltip]='item.enabel?"禁用":"启用"' (change) = 'changeNodeEnabel(item, $event)'>
          </md-slide-toggle>
          <button *ngIf="i == platformInfo.accessNodes.length-1 && !ifAddNode" (click) = 'ifAddNode = true'>添加</button>
        </div>
        <div class="access_item" *ngIf="ifAddNode">
          <input type="text" #newNode>
          <i class="iconfont icon-baocun" mdTooltip='保存' (click) = 'addNode(newNode.value)'></i>
          <i class="iconfont icon-guanbi" mdTooltip='取消' (click) = 'ifAddNode = false'></i>
        </div>
        <!-- <div>{{statusArray[platformInfo.stateCode-1]}}</div> -->
      </section>


      <section class="example-section">
        <label class="example-margin label">发送心跳 :</label>
        <md-slide-toggle class="example-margin" [color]="primary" [(ngModel)]="platformInfo.heart" (change)="setHeart()">
        </md-slide-toggle>
      </section>
      <section class="example-section">
        <label class="example-margin label">加密 :</label>
        <md-slide-toggle class="example-margin" [color]="primary" [(ngModel)]="platformInfo.sign" (change)="setSign()">
        </md-slide-toggle>
      </section>
      <section class="example-section">
        <label class="example-margin label">解密 :</label>
        <md-slide-toggle class="example-margin" [color]="primary" [(ngModel)]="platformInfo.checkSign" (change)="setDesign()">
        </md-slide-toggle>
      </section>

      <div>
        <button (click)="editPlatform()" md-button style='background:#2196f3;color:white;'>{{ifEdit?"保存":"编辑"}}</button>
      </div>

  </div>
</div>
